package com.ziyia.libaray;

import android.content.pm.PackageManager;
import android.icu.lang.UCharacter;

import androidx.annotation.NonNull;
import androidx.appcompat.view.ActionMode;
import androidx.fragment.app.Fragment;

import java.security.Permission;
import java.util.ArrayList;
import java.util.List;

import javax.security.auth.callback.Callback;

public class InvisibleFragment extends Fragment {

    public void requestNow(Permission cb , String...  permissions) {

        requestPermissions(permissions, 1);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull @org.jetbrains.annotations.NotNull String[] permissions, @NonNull @org.jetbrains.annotations.NotNull int[] grantResults) {
        if (requestCode == 1) {
            List<String> deniedList = new ArrayList<>();
            for (int i = 0; i < grantResults.length; i++) {
                int grantResult = grantResults[i];
                if (grantResult != PackageManager.PERMISSION_GRANTED) {
                    deniedList.add(permissions[i]);
                }
            }
            boolean empty = deniedList.isEmpty();
        }
    }
}
